package com.alipay.service;

import com.alipay.config.AlipayConfig;
import com.alipay.util.AlipaySubmit;

import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: 邱孝兵
 * Date: 2014/11/24
 * Time: 15:05
 */
public class AliPayService {

    /**
     * 支付宝提供给商户的服务接入网关URL(新)
     */
    private static final String ALIPAY_GATEWAY_NEW = "https://mapi.alipay.com/gateway.do?";

    /**
     * 构造标准双接口
     * @param sParaTemp 请求参数集合
     * @return 表单提交HTML信息
     */
    public static String trade_create_by_buyer(Map<String, String> sParaTemp) {

        //增加基本配置
        sParaTemp.put("service", "create_partner_trade_by_buyer");
        sParaTemp.put("partner", AlipayConfig.partner);
        sParaTemp.put("return_url", AlipayConfig.return_url);
        sParaTemp.put("notify_url", AlipayConfig.notify_url);
        sParaTemp.put("seller_email", AlipayConfig.seller_email);
        sParaTemp.put("_input_charset", AlipayConfig.input_charset);

        String strButtonName = "确认";

        return AlipaySubmit.buildRequest(sParaTemp, ALIPAY_GATEWAY_NEW, "get", strButtonName);
    }

}
